{extend name="common/main"}

{block name="css"}
<!-- 本页面需要额外添加的css请在此处添加 -->
{/block}
{block name="body"}
<body>  
<header>
  <div class="tab_nav">
    <div class="header">
      <div class="h-left"><a class="sb-back" href="javascript:history.back(-1)" title="返回"></a></div>
      <div class="h-mid">我的收藏</div>
      <div class="h-right">
        <aside class="top_bar">
          <div onClick="show_menu();$('#close_btn').addClass('hid');" id="show_more"><a href="javascript:;"></a> </div>
        </aside>
      </div>
    </div>
  </div>
</header>
{include file="common/goods_nav"}
<div id="tbh5v0">

<div class="main" id="user_goods_ka_1">
{empty name="goods_list"}
<div id="list_0_0" class="font12">您没有任何收藏哦！</div>
{else/}
<form name="theForm" method="post" action="">
 <div class="shouchang">
 <ul>
  {foreach name="goods_list" item="goods"}
  		<li>
              <div class="imgurl">
              	<a href="{:url('Goods/goodsInfo',array('id'=>$goods['goods_id']))}" >
              	<img src="{$goods.original_img}" width="100" height="100"></a>
              </div>
              <a href="{:url('Goods/goodsInfo',array('id'=>$goods['goods_id']))}">
              <div class="order_info">
                <dl>
                  <dt>{$goods.goods_name|mb_substr=0,14,'utf-8'}...</dt>
                  <dd><strong>{$goods.shop_price}</strong></dd>
                </dl>
              </div>
              </a>
              <div class="dingdancaozuo" >
              <a href="javascript:AjaxAddCart({$goods.goods_id},1)" class="s_flow" style=" color:#fff">加入购物车</a>
              <a onclick="del_button('{$goods.collect_id}');" href="javascript:void(0);" href="javascript:;" class="s_out" style=" color:#fff" >删除</a></div>
        </li>
  {/foreach}
 </ul>
 </div>
</form>
{notempty name="goods_list"}
   <div id="getmore" style="font-size:.24rem;text-align: center;color:#888;padding:.25rem .24rem .4rem; clear:both">
  		<a href="javascript:void(0)" onClick="ajax_sourch_submit()">点击加载更多</a>
  </div>  
{/notempty}
{/empty}
</div>
<!--  
<div class="main" id="user_goods_ka_2" style="display:none">
 	<div id="list_0_0" class="font12">您还没有收藏店铺哦！</div>
</div>-->
</div>
{include file="common/bar"}
</body>
{/block}

{block name="js"}
<script src="/layer/layer.js"></script>
<script>
var  page = 1;
 /*** ajax 提交表单 查询订单列表结果*/  
 function ajax_sourch_submit()
 {	 	 	 
        page += 1;
		$.ajax({
			type : "GET",
			url:"{:url('User/collect_list')}",
			data :{page:page} ,// 你的formid 搜索表单 序列化提交
			success: function(data)
			{
				if($.trim(data) == '')
					$('#getmore').hide();
				else
				    $(".shouchang > ul").append(data);
			}
		});
 }

    // 删除收藏
    function del_button(id) {
        layer.confirm("确定删除？", {btn: ["确定","取消"], shade: 0.5}, function(){
            // 删除权限组
            $.post("{:url('User/cancel_collect')}", {collect_id: id}, function(res) {
                if (res.code == 201) {
                    layer.msg(res.msg, {shade: 0.5, time: 1000, icon: 2});
                    return false;
                }
                location.href = "{:url('User/collect_list')}";
            });
        }, function () {});
    }
</script>
{/block}